#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>

int main(int argc, char const *argv[])
{
    /* code */
    pid_t pid;

    pid = fork();

    if (pid == 0) {
        printf("child process\n");

        sleep(2);
        exit(88);
    } else if (pid > 0) {
        printf("parent process\n");
        int status = 0;
        pid_t rcpid = waitpid(-1, &status, 0); // 等待任意子进程
        printf("rcpid: %d, status: %d\n", rcpid, status);
    }
    return 0;
}
